home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / graphic / piclb191.zip / PICLAB.DOC < prev    next >
Text File  |  1991-12-03  |  40KB  |  1,076 lines

  1. PICLAB.DOC
  2. December 3, 1991
  3.  
  4. Piclab 1.91 is a public domain image processing program by Lee
  5. Daniel Crocker and the Stone Soup Group.  It should be distributed
  6. with the following files:
  7.  
  8. PL.EXE          The program itself.
  9. PL286.EXE       Faster, smaller version for 286 (and up) machines.
  10. PICLAB.DOC      This file.
  11. PL.HLP          Text file for the HELP command.
  12. PICLAB.PIF      Windows 3.0 386 enhanced mode PIF.
  13. PICLAB.ICO      Windows 3.0 icon.
  14. GAMMA1.MAP  \
  15. GAMMA2.MAP   X  Color maps for viewing grayscale and pseudo-color.
  16. PSEUDO.MAP  /
  17. SSTOOLS.SMP     Sample SSTOOLS.INI file.
  18.  
  19. If you are missing one or more of these files, contact the author
  20. at one of the addresses listed at the end of this document.
  21.  
  22.  
  23.  
  24. Overview
  25. ========
  26.  
  27. Piclab operates on "images", so I will begin by explaining exactly
  28. what an image is and how Piclab classifies them.
  29.  
  30. For our purposes, an image is a data set that describes
  31. the reflectance of a 2-dimensional surface such as a photograph.  In
  32. particular, an image is a 2-dimensional array of "pixels" (a short
  33. form of "picture elements"), each of which contains data for the
  34. small rectangular area of the image it represents.
  35.  
  36. There are many systems in which image data represents "objects"
  37. rather than pixels.  PostScript is probably the most notable example. 
  38. The commands sent to a PostScript device tell it to draw lines or
  39. boxes or characters and let the device decide how it will perform the
  40. commands it gets.  Piclab does not deal with object-based images or
  41. devices.
  42.  
  43. Image data comes in several flavors, and while all are related in
  44. many ways, there are distinctions important to keep in mind.  I will
  45. divide image data into four classes: bitmapped, grayscale,
  46. golor-mapped, and true-color.  In all of these formats an image is
  47. represented as a rectangular array of pixels, each of which may
  48. contain some value.
  49.  
  50. Bitmapped images are collections of on/off dots.  That is, each pixel
  51. can be either "on" or "off", with no states in between.  This type of
  52. image can be displayed on just about any type of computer and is
  53. especially suited to printer output.  The disadvantages are the
  54. inability to represent color, and the lack of detail.  With large
  55. bitmapped images, one can get a surprising amount of detail by
  56. simulating shades of gray by dot patterns.  This process, called
  57. halftoning, is used by newspapers to print photographs.
  58.  
  59. At this time, Piclab does not deal directly with bitmapped images,
  60. although it can treat them as grayscale and can output images to
  61. bitmapped devices.
  62.  
  63. Grayscale images represent images by storing the intensity of light
  64. for each pixel on a scale of more than just on/off.  Typically, a
  65. grayscale image will allow 64 to 256 shades of gray at each pixel. 
  66. Very high quality renderings of black and white photographs can be
  67. stored in this format.
  68.  
  69. As an aside, the term "black and white" is often used to describe
  70. both bitmapped images and grayscale images.  For this reason, I will
  71. not use the term in this document.  Another common term for grayscale
  72. is "monochrome", which is often used to describe monitors that can
  73. display only shades of one color (often green or amber).
  74.  
  75. Color-mapped images are the ones most common on personal computers.
  76. Each pixel in an image is represented by a number (called an index)
  77. that is used to look up the pixel's actual color in a table (called
  78. the palette, much like an artist's palette).  These images are
  79. popular because they can be very colorful, yet take up less memory
  80. than full-color images (described next).  The size of the color
  81. palette varies among formats, but is typically 16 to 256.
  82.  
  83. True-color images are the highest quality representation, and the
  84. largest files as well.  Each pixel contains the complete color
  85. information for that pixel, usually expressed as the intensity of the
  86. red, green, and blue color components of the light at that location.
  87.  
  88. Piclab deals directly with grayscale, color-mapped and true-color
  89. images, regardless of the display capabilities of the hardware on
  90. which it is running.  In fact, Piclab can be used to enhance and
  91. print images on machines with no display at all.
  92.  
  93. I must stress that there is no connection between the images
  94. Piclab deals with and the type of display on your computer.  Piclab
  95. has a SHOW command that displays the image it is working with, but if
  96. the image is more detailed than your display can handle, Piclab will
  97. do its best to approximate the image on your display.  Regardless of
  98. what the display looks like, the image itself is always stored and
  99. operated upon in full detail.
  100.  
  101. So what's the point?  You might think that having image data more
  102. accurate than your computer can display is wasteful, but it is not. 
  103. One reason is that images get passed around to users of different
  104. machines, and the more accurate the image data, the better each
  105. machine will be able to display it.  You can also do things like
  106. print color images to a color printer even though you have no color
  107. display on your computer.  Lastly, hardware to display images as
  108. accurately as Piclab stores them does exist, and is becoming more
  109. affordable every day.  If you keep your images stored in their full
  110. accuracy, you will be better able to take advantage of any new
  111. hardware you may get.
  112.  
  113.  
  114.  
  115. General Operation
  116. =================
  117.  
  118. After starting Piclab by typing "PL" at the system command line, the
  119. user may enter any of a number of commands, each of which is
  120. performed immediately.
  121.  
  122. If you give arguments to the PL command, the first is taken as the
  123. name of a file containing Piclab commands, and the rest are treated
  124. as arguments to that program, accessed as %1, %2, etc., much like DOS
  125. batch file arguments.  This feature can be used to create programs
  126. for specific tasks.
  127.  
  128. Commands generally operate on two internal picture buffers called OLD
  129. and NEW.  Most commands start by deleting OLD and renaming NEW to
  130. OLD.  They then perform some transformation on OLD storing the result
  131. in NEW.  The command UNDO swaps NEW and OLD--effectively reversing
  132. the last operation.
  133.  
  134. OLD and NEW are stored on disk.  This decision was made primarily
  135. because my taste in pictures is better than my budget for RAM.  If
  136. you are dealing with simpler pictures, or if you have RAM to burn,
  137. you can direct Piclab to store OLD and NEW on a RAMdisk.  In MSDOS
  138. and similar operating systems, this is done by typing "SET TMP=D:" at
  139. the system command line before running Piclab, where D: is the drive
  140. or directory specification of the RAMdisk.
  141.  
  142. Piclab can read and write images in different file formats.  The LOAD
  143. command is used to read an image in one of these formats into the
  144. edit buffers.  The SAVE is used to write the contents of the edit
  145. buffers into one of these formats.  Every session with Piclab will
  146. generally begin with a LOAD, and end with a SAVE (or perhaps a PRINT)
  147. with some processing in between.  A file may be loaded from one file
  148. format and saved in a different one, thereby converting among formats.
  149.  
  150. Command parsing in Piclab is roughly like that of the system command
  151. line.  The line is broken into words that must be separated by
  152. spaces; the first word specifies the actual command and the remaining
  153. words are passed to the command handler as arguments.  The individual
  154. command-handling routines are responsible for interpreting their
  155. arguments.  Generally, a word may be shortened as long as it does not
  156. conflict with any other word in the same context. For example, the
  157. LIST COMMANDS command may be abbreviated LIS COM.
  158.  
  159. Any words in the command line that begin with the '%' character are
  160. replaced as follows: if the remainder of the word is a number, the
  161. word is replaced with the argument to the PL command in that position
  162. (starting with 0).  Otherwise, the word is replaced with the value of
  163. the DOS environment variable named by the word.  For example, here is
  164. a short Piclab program (named V2E) to convert a VGA 256-color image
  165. into an EGA 16-color image:
  166.  
  167. GLOAD %1
  168. UNMAP
  169. RESCALE 640 350
  170. EGAPAL
  171. MAP
  172. GSAVE %2
  173.  
  174. With this program in the current directory, typin